import type { Graph } from "@antv/x6";

const NodeId = "ForkGroupNode";
const NodeLabel = "并行分组";
const NodeTips = "(用于[并行]节点内, 分组内顺序执行)"
const acceptChildrenIds = ['NetworkNode', 'VariableNode'];

export const createForkGroupNode = (graph:Graph)=>{
    const node = graph.createNode({
        shape: "rect",
        width: 80,
        height: 30,
        label: NodeLabel,
        attrs: commonAttrs,
        data: {
          id: NodeId,
          hasChildren: true,
          acceptChildrenIds: acceptChildrenIds
        }
    });
    
    return node;
}

export const getForkGroupDropNode=(node:any)=>{
    node.prop("size", { width: 350, height: 100 });
    node.attr("text", {
      "fontSize": 14,
      "fill": "white",
      "refX": "10px",
      "refY": "10px",
      "textAnchor": "left",
      "textVerticalAnchor": "top",
      "text": NodeLabel + NodeTips
    })
    return node;
}

const commonAttrs = {
    body: {
        fill: '#fff',
        stroke: '#8f8f8f',
        strokeWidth: 1,
    },
  }
  